feat(client): migrate achievements from GraphQL to gRPC#258
feat(client): migrate achievements from GraphQL to gRPC#258MartianGreed wants to merge 1 commit intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Replace GraphQL-based achievement fetching with gRPC using @dojoengine/grpc methods (getAchievements, getPlayerAchievements). - Add fromGrpc() methods to Trophy and Progress models - Create trophies-grpc.ts and progressions-grpc.ts atoms - Update hooks to use new gRPC atoms - Simplify project types (no model selector needed)
6019f5b to
8fd33f2
Compare
| achievement, | ||
| taskProgress, | ||
| playerEntry.stats?.last_achievement_at, | ||
| ); |
There was a problem hiding this comment.
All player achievements share the same timestamp
High Severity
The Progress.fromGrpc call passes playerEntry.stats?.last_achievement_at as the timestamp for all task progress entries of all achievements belonging to a player. This single player-level timestamp replaces what was previously per-achievement completionTime in the GraphQL implementation. As a result, all achievements for a player will appear to have been completed at the same time, breaking leaderboard calculations that rely on completion order and making achievement event timelines inaccurate. The code likely needs to use a per-achievement completion timestamp (possibly from achievementProgress) rather than the player's overall last_achievement_at.
Summary
@dojoengine/grpcmethodsfromGrpc()methods to Trophy and Progress models for data mappingtrophies-grpc.ts,progressions-grpc.ts)Changes
client/src/models/trophy.ts- AddfromGrpc()static methodclient/src/models/progress.ts- AddfromGrpc()static methodclient/src/effect/atoms/trophies-grpc.ts- New gRPC atom for achievementsclient/src/effect/atoms/progressions-grpc.ts- New gRPC atom for player progressclient/src/effect/hooks/achievements.ts- Update imports to use gRPC atomsclient/src/effect/atoms/index.ts- Update exportsTest plan
Note
Moves achievements and player progress to gRPC and updates consumers.
trophies-grpc.tsandprogressions-grpc.tsatoms usingToriiGrpcClient.getAchievements/getPlayerAchievements; aggregate results by project and exposetrophiesDataAtom/progressionsDataAtomfromGrpc()toTrophyandProgressfor mapping gRPC payloadshooks/achievements.tsto consume new gRPC atoms and simplify project types (no model selector)atoms/index.tsexports to point to gRPC versions and remove unused meta typesWritten by Cursor Bugbot for commit 8fd33f2. This will update automatically on new commits. Configure here.